﻿using System.Collections.Generic;

namespace Dotnet.Utils.Utility.ObjectExtensions
{
    public class GeneralType
    {
        public static bool Contains(string fullType)
        {
            return GeneralType.generalTypes.Contains(fullType);
        }

        public static string ConvertXSDType(string fullType)
        {
            switch (fullType)
            {
                case "System.String":
                    return "xs:string";

                case "System.Int32":
                    return "xs:int";

                case "System.DateTime":
                    return "xs:dateTime";

                case "System.Boolean":
                    return "xs:boolean";

                case "System.Single":
                    return "xs:float";

                case "System.Byte":
                    return "xs:byte";

                case "System.SByte":
                    return "xs:unsignedByte";

                case "System.Int16":
                    return "xs:short";

                case "System.UInt16":
                    return "xs:unsignedShort";

                case "System.UInt32":
                    return "xs:unsignedInt";

                case "System.Int64":
                    return "xs:long";

                case "System.UInt64":
                    return "xs:unsignedLong";

                case "System.Double":
                    return "xs:double";

                case "System.Decimal":
                    return "xs:decimal";
            }
            return string.Empty;
        }

        private static readonly List<string> generalTypes = new List<string>
        {
            "System.Byte",
            "System.SByte",
            "System.Int16",
            "System.UInt16",
            "System.Int32",
            "System.UInt32",
            "System.Int64",
            "System.UInt64",
            "System.Double",
            "System.Decimal",
            "System.Single",
            "System.Char",
            "System.Boolean",
            "System.String",
            "System.DateTime"
        };
    }
}